package com.sprite.support.wechat.bean.req;

import com.sprite.support.wechat.service.WechatMessage;

/**
 * 
 * @author Jack
 *
 */
public abstract class ReqBaseMessageBean extends WechatMessage {
	
	//代理微信appId
	private String appId;
	// 开发者微信号  
	protected String toUserName;
    // 发送方帐号（一个OpenID）  
    protected String fromUserName;
    // 消息创建时间 （整型）  
    protected long createTime;
    // 消息类型（text/image/location/link）  
    protected String msgType;
    // 消息id，64位整型  
    protected long msgId;

    public ReqBaseMessageBean(){}

	public ReqBaseMessageBean(ReqBaseMessageBean baseMessageBean){
		this.appId = baseMessageBean.appId;
		this.toUserName = baseMessageBean.toUserName;
		this.fromUserName = baseMessageBean.fromUserName;
		this.createTime = baseMessageBean.createTime;
		this.msgType = baseMessageBean.msgType;
		this.msgId = baseMessageBean.msgId;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getToUserName() {
		return toUserName;
	}

	public void setToUserName(String toUserName) {
		this.toUserName = toUserName;
	}

	public String getFromUserName() {
		return fromUserName;
	}

	public void setFromUserName(String fromUserName) {
		this.fromUserName = fromUserName;
	}

	public long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(long createTime) {
		this.createTime = createTime;
	}

	public String getMsgType() {
		return msgType;
	}

	public void setMsgType(String msgType) {
		this.msgType = msgType;
	}

	public long getMsgId() {
		return msgId;
	}

	public void setMsgId(long msgId) {
		this.msgId = msgId;
	}

	@Override
	public int hashCode() {
		return Long.hashCode(msgId);
	}

	@Override
	public boolean equals(Object obj) {
    	if(obj == null){
    		return false;
		}

    	if(!ReqBaseMessageBean.class.isInstance(obj)){
    		return false;
		}

    	return this.msgId == ((ReqBaseMessageBean)obj).msgId;
	}

}
